var obj={}
var Observer={
    on(name,fun){
        if(obj[name] instanceof Array){
            obj[name].push(fun)
        }else{
            obj[name]=[fun]
        }
    },
    emit(name,...arr){
        if(obj[name]){
            obj[name].forEach(fun=>fun(...arr))
        }else{
            throw new Error('没有'+name+"事件")
        }
    }
}

export{
    Observer,
    Observer as default
}